function [n] = rtxi2datac(varargin)
% nrn2datac converts the output from neuron to a datac file
% calls the 2 routines to do it: neuron_read and mat2datac
%
% if a second filename is passed to the input, then that will be the name
% of the output file, rather than the default. 

if(nargin > 0)
    file = varargin{1};
end;
[voltage, current, time, DFILE] = rtxi_read(file);
if(isempty(DFILE))
   fprintf(2, 'Unable to read rtxi input files %s\n', file);
   return;
end
if(nargin < 2)
    filename = [DFILE.fullfile];
else
    filename = varargin{2};
end;
if(nargin >= 3)
    DFILE.comment = varargin{3};
end;
% note: convert voltage from V to mV; current from A to pA

err = mat2datac(filename, 1000*voltage, (10^12)*current, DFILE);